<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sb" uri="/struts-bootstrap-tags"%>
<%@ include file="/page/company/comHeader.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>订单详情管理列表</title>
<script type="text/javascript" src="<%=basePath%>js/tablecreate/jlinq.js"></script>
<script type="text/javascript" src="<%=basePath%>js/tablecreate/jquery-dynamicTable.js"></script>
<script type="text/javascript" src="<%=basePath%>js/tablecreate/pager.js"></script> 
<script type="text/javascript" src="<%=basePath%>js/tablecreate/modal.js"></script>

<style type="text/css">
a:LINK{text-decoration: none;color:black;}
a:visited {text-decoration:none ; color:black;}
a:hover {text-decoration:underline ; color:black;}
a:active {text-decoration:none ; color:black;} 
</style>
<sb:head/>
</head>
<body  onload="comOrderItemList()">

<h3>订单详情管理列表</h3>
<div style="background-color:#dcdcdc;width: 100%;height:36px;">
<div style="background-color:#dcdcdc;width: 500px;height:36px;float:left;">
<s:hidden value="%{#session.company.comId}" id="comId"></s:hidden>
<s:hidden value="%{orderId}" id="orderId"></s:hidden>
<input id="menuName" class="input-medium search-query" name="menuName" value=""/>
<input type="button" class="btn btn-success" id="" onclick="searchList()" value="查询"/>
</div>
</div>
<div id="lists">
<div id="list" ></div>
<div id="page"></div>
</div>
<script type="text/javascript">
var orderId=$("#orderId").val();
var url=[{loadUrl:"orderitem_getOrderItems?orderId="+orderId,editUrl:"<%=basePath%>com/orderitem_editOrderItem?orderItemId=",delUrl:"orderitem_delOrderItem"}];//请求地址
var postData={menuName:$("#menuName").val()};
var pageId="page";
var objClassName="list_light";
var objColumn = [
					{ ColumnName: "订单编号", DataId: "orderId", Width: 200, DataAlign: "left", Format: null, OnClick: null },
					{ ColumnName: "菜单名称", DataId: "menuName", Width: 100, DataAlign: "left", Format: null, OnClick: null },
					{ ColumnName: "菜单现价", DataId: "menuNowPrice", Width: 100, DataAlign: "left", Format: null, OnClick: null },
					{ ColumnName: "购买数量", DataId: "menuNum", Width: 100, DataAlign: "left", Format: null, OnClick: null },
					{ ColumnName: "金额", DataId: "profit", Width:200, DataAlign: "left", Format: null, OnClick: null },
					{ ColumnName: "操作", DataId: "Operation", Width: 200, DataAlign: "left", Format: null, OnClick: null },
                 ];
function comOrderItemList(){
	   $.ajax({
			type: "post",
	        url: url[0].loadUrl,
	        data: postData,
	        dataType: "json",
	        success: function(data){
          var objData = new Array(data.list.length);
          for(var i=0;i<data.list.length;i++){
              var orderFlage="";
              var op="";
            	  op+="<a class='edit'onclick=\"edit('"+url[0].editUrl+""+data.list[i].orderItemId+"')\" title=\"编辑\" href=\"javascript:void(0)\" id='"+data.list[i].orderItemId+"'>编辑</a>&nbsp;&nbsp;";
                  op+="<a href='javascript:void(0);' onclick='delInfo(\"orderitem_delOrderItem?orderItemId="+data.list[i].orderItemId+"\")' title='删除'>删除</a> ";
            	  objData[i]={orderId:orderId,menuName:data.list[i].menuName,menuNowPrice:data.list[i].menuNowPrice,
            			  menuNum:data.list[i].menuNum,profit:data.list[i].profit,Operation:op}; 
              }
               $("#list").MakeTable(objColumn, objData, objClassName);
        	  $("#page").MakePage(data.page[0]);
		        }
			});
	   }
function searchList(){
	var page=$("#selPage").val();
	var pageRow=$("#selRow").val();
	postData={menuName:$("#menuName").val(),initPage:page,pageRow:pageRow};
	comOrderItemList();
}
var j=0;
function OrderSort(order){
	var order=order;
	j++;
	if(j%2==0){
          var sort="desc";
		}else if (j%3==0) {
			var sort="asc";
		}else{
      order="created";
      var sort="desc";
			}
	var page=$("#selPage").val();
	var pageRow=$("#selRow").val();
	postData={menuName:$("#menuName").val(),order:order,sort:sort,initPage:page,pageRow:pageRow};
	comOrderItemList();
}
function goPage(){
	var page=$("#selPage").val();
	var pageRow=$("#selRow").val();
	postData={menuName:$("#menuName").val(),initPage:page,pageRow:pageRow};
	comOrderItemList();
}
function changePage(page){
	var pageRow=$("#selRow").val();
	postData={menuName:$("#menuName").val(),initPage:page,pageRow:pageRow};
	comOrderItemList();
}
function goRow(){
	var pageRow=$("#selRow").val();
	var page=$("#selPage").val();
	comOrderItemList();
}

</script>
<%@ include file="/page/common/modal.jsp"%>
<div style="position:fixed; bottom:0; left:0; width:100%; _position:absolute;">
<jsp:include page="/page/company/comFooter.jsp"></jsp:include>
</div>
</body>
</html>